package champion.virus;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.media.MediaPlayer;
import android.os.Bundle;

public class MainActivity extends Activity {
    MediaPlayer mainSound;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);

	mainSound = MediaPlayer.create(MainActivity.this, R.raw.evil_laugh);
	mainSound.start();

	// TODO consider adding this back in
	// removeAppIcon();

	Thread timer = new Thread() {
	    @Override
	    public void run() {
		try {
		    sleep(2000);
		} catch (InterruptedException e) {
		    e.printStackTrace();
		} finally {
		    Intent openAnnoyActivity = new Intent(
			    "champion.virus.ANNOYACTIVITY");
		    startActivity(openAnnoyActivity);
		}
	    }
	};

	timer.start();
    }

    @Override
    protected void onPause() {
	// TODO Auto-generated method stub
	super.onPause();
	mainSound.release();
	finish();
    }

    private void removeAppIcon() {
	ComponentName componentToDisable = new ComponentName("champion.virus",
		"champion.virus.MainActivity");

	getPackageManager().setComponentEnabledSetting(componentToDisable,
		PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
		PackageManager.DONT_KILL_APP);
    }
}